home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Sample Code / AppsToGo / DTS.Lib / DTS.Lib.headers / DTS.Lib.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-09-22  |  15.8 KB  |  502 lines  |  [TEXT/MPS ]

  1. #ifndef __DTSLib__
  2. #define __DTSLib__
  3.  
  4. #ifndef __TYPES__
  5. #include <Types.h>
  6. #endif
  7.  
  8. #ifndef __APPLEEVENTS__
  9. #include <AppleEvents.h>
  10. #endif
  11.  
  12. #ifndef __FILES__
  13. #include <Files.h>
  14. #endif
  15.  
  16. #ifndef __MOVIES__
  17. #include <Movies.h>
  18. #endif
  19.  
  20. #ifndef __PRINTING__
  21. #include <Printing.h>
  22. #endif
  23.  
  24. #ifndef __TREEOBJ__
  25. #include "TreeObj.h"
  26. #endif
  27.  
  28. #ifndef __UTILITIES__
  29. #include "Utilities.h"
  30. #endif
  31.  
  32. #ifndef __WINDOWS__
  33. #include <Windows.h>
  34. #endif
  35.  
  36. /********/
  37.  
  38. typedef void        (*CalcFrameRgnProcPtr)(FileRecHndl frHndl, WindowPtr window, RgnHandle rgn);
  39. typedef void        (*ContentClickProcPtr)(WindowPtr window, EventRecord *event, Boolean firstClick);
  40. typedef Boolean        (*ContentKeyProcPtr)(WindowPtr window, EventRecord *event, Boolean *passThrough);
  41. typedef void        (*DrawFrameProcPtr)(FileRecHndl frHndl, WindowPtr window, Boolean activate);
  42. typedef OSErr        (*FreeDocumentProcPtr)(FileRecHndl frHndl);
  43. typedef OSErr        (*FreeWindowProcPtr)(FileRecHndl frHndl, WindowPtr window);
  44. typedef OSErr        (*ImageProcPtr)(FileRecHndl frHndl);
  45. typedef OSErr        (*InitContentProcPtr)(FileRecHndl frHndl, WindowPtr window);
  46. typedef OSErr        (*ReadDocumentProcPtr)(FileRecHndl frHndl);
  47. typedef OSErr        (*ReadDocumentHeaderProcPtr)(FileRecHndl frHndl);
  48. typedef void        (*ResizeContentProcPtr)(WindowPtr window, short oldh, short oldv);
  49. typedef void        (*ScrollFrameProcPtr)(FileRecHndl frHndl, WindowPtr window, long dh, long dv);
  50. typedef void        (*UndoFixupProcPtr)(FileRecHndl frHndl, Point contOrg, Boolean afterUndo);
  51. typedef Boolean        (*WindowCursorProcPtr)(FileRecHndl frHndl, WindowPtr window, Point globalPt);
  52. typedef OSErr        (*WriteDocumentProcPtr)(FileRecHndl frHndl);
  53. typedef OSErr        (*WriteDocumentHeaderProcPtr)(FileRecHndl frHndl);
  54. typedef Boolean        (*AdjustMenuItemsProcPtr)(WindowPtr window, short menuID);
  55. typedef Boolean        (*DoMenuItemProcPtr)(WindowPtr window, short menuID, short menuItem);
  56.     /* The above are the procPtrs that are kept in a file reference handle.  These point to
  57.     ** the functions in your application that are automatically called by the framework.
  58.     ** You will find stub functions in the files Window.c, WindowDialog.c, and WindowPalette.c
  59.     ** The framework initializes these procPtrs to point to the correct set of functions, based
  60.     ** on the type of the window (kwIsDocument, kwIsModalDialog, or kwIsPalette). */
  61.  
  62. typedef OSErr        (*HideWindowProcPtr)(FileRecHndl frHndl, WindowPtr window);
  63.     /* There is a global in Window2.c called gHideWindowProc that, if set to non-nil, is called
  64.     ** when a window is hidden by the framework.  If you have windows that are only hidden, and
  65.     ** not disposed of, it may be important to the application to get a message that the window
  66.     ** is being hidden.  Set gHideWindowProc to point to a procedure in your application
  67.     ** conforming to the above prototype, and it will be called when a window is hidden. */
  68.  
  69. typedef long        (*DocScrollBarProc)(FileRecHndl frHndl, ControlHandle ctl, short message, long val);
  70. #define kscrollHAdjust        0
  71. #define kscrollVAdjust        1
  72. #define kscrollGetHOrigin     2
  73. #define kscrollGetVOrigin     3
  74. #define kscrollGetHLongOrigin 4
  75. #define kscrollGetVLongOrigin 5
  76.     /* The document scrollbars can be coerced into handling long values.  If you need long values
  77.     ** from the document scrollbars because your document space is greater than 32k, then
  78.     ** place a DocScrollBarProc in the refCon field of the document scrollbar.  You will then get
  79.     ** called at appropriate times with the various messages.  The proc's job is to convert the
  80.     ** short value from the scrollbar to a logical long (and back again) for the various messages.
  81.     ** The file reference handle is also passed in, so you can combine the state of the document
  82.     ** with the scrollbar's short value to derive the long scroll value. */
  83.  
  84. typedef TreeObjHndl    (*GetPreferenceProcPtr)(OSType prefType, Boolean *newPref);
  85.  
  86. #ifdef powerc
  87. #pragma options align=mac68k
  88. #endif
  89. typedef struct {
  90.     OSType                        sfType;
  91.     Boolean                        defaultDoc;
  92.     Movie                        movie;
  93.     short                        movieResID;
  94.     short                        movieFlags;
  95.     Boolean                        movieDataRefWasChanged;
  96.     Boolean                        docDirty;
  97.     long                        modNum;
  98.     long                        modTick;
  99.     Boolean                        readOnly;
  100.     short                        refNum;
  101.     short                        resRefNum;
  102.     FSSpec                        fss;
  103.     short                        windowID;
  104.     WindowPtr                    window;
  105.     PositionWndProcPtr            getDocWindow;
  106.     CalcFrameRgnProcPtr            calcFrameRgnProc;
  107.     ContentClickProcPtr            contentClickProc;
  108.     ContentKeyProcPtr            contentKeyProc;
  109.     DrawFrameProcPtr            drawFrameProc;
  110.     FreeDocumentProcPtr            freeDocumentProc;
  111.     FreeWindowProcPtr            freeWindowProc;
  112.     ImageProcPtr                imageProc;
  113.     InitContentProcPtr            initContentProc;
  114.     ReadDocumentProcPtr            readDocumentProc;
  115.     ReadDocumentHeaderProcPtr    readDocumentHeaderProc;
  116.     ResizeContentProcPtr        resizeContentProc;
  117.     ScrollFrameProcPtr            scrollFrameProc;
  118.     UndoFixupProcPtr            undoFixupProc;
  119.     WindowCursorProcPtr            windowCursorProc;
  120.     WriteDocumentProcPtr        writeDocumentProc;
  121.     WriteDocumentHeaderProcPtr    writeDocumentHeaderProc;
  122.     AdjustMenuItemsProcPtr        adjustMenuItemsProc;
  123.     DoMenuItemProcPtr            doMenuItemProc;
  124.     long                        attributes;            /* Here down is window content information. */
  125.     Rect                        windowSizeBounds;
  126.     ControlHandle                hScroll;
  127.     ControlHandle                vScroll;
  128.     short                        hScrollIndent;
  129.     short                        vScrollIndent;
  130.     short                        leftSidebar;
  131.     short                        topSidebar;
  132.     short                        hArrowVal;
  133.     short                        vArrowVal;
  134.     short                        hPageVal;
  135.     short                        vPageVal;
  136. } FileStateRec;
  137. #ifdef powerc
  138. #pragma options align=reset
  139. #endif
  140.  
  141. #ifdef powerc
  142. #pragma options align=mac68k
  143. #endif
  144. typedef struct {
  145.     long            windowTag[2];        /* Used to match up windows.                    */
  146.     short            endSendInfo;        /* Above is send info.                            */
  147.  
  148.     short            connected;            /* Flag showing we are connected.                */
  149.     AEAddressDesc    remoteLoc;            /* AppleEvents address of remote user.            */
  150.     Str32            remoteName;            /* Name of user connected to.                    */
  151.     Str32            remoteZone;            /* Zone of user connected to.                    */
  152.     Str32            remoteMachine;        /* Machine name of user connected to.            */
  153.  
  154.     Str255            remotePath;            /* Full path of user connected to.    */
  155.     Str32            remoteApp;            /* Name of user connected to.        */
  156.  
  157.     short            endLocalInfo;        /* Above info is for one machine only.            */
  158. } ConnectRec;
  159. #ifdef powerc
  160. #pragma options align=reset
  161. #endif
  162.  
  163. #ifdef powerc
  164. #pragma options align=mac68k
  165. #endif
  166. typedef struct {
  167.     short        version;            /* The file format version.                    */
  168.     Boolean        printRecValid;        /* True if prRec has been created.            */
  169.     TPrint        print;                /* Print record for file.                    */
  170.     Rect        structureRect;        /* Remember where window was when saved.    */
  171.     Rect        contentRect;        /* Remember where window was when saved.    */
  172.     Rect        stdState;            /* This and below rect used for saving        */
  173.     Rect        userState;            /* zoom information for window.                */
  174.     long        hDocSize;            /* hDocSize and vDocSize have to be saved    */
  175.     long        vDocSize;            /* with the document, or recalculated        */
  176.                                     /* when the file is opened so that the        */
  177.                                     /* window can be created the correct size.    */
  178.     short        endDocHeaderInfo;    /* End version, print, and window info.        */
  179. } DocHeaderInfo;
  180. #ifdef powerc
  181. #pragma options align=reset
  182. #endif
  183.  
  184. #ifdef powerc
  185. #pragma options align=mac68k
  186. #endif
  187. struct AEHandler{
  188.     AEEventClass            theEventClass;
  189.     AEEventID                theEventID;
  190.     AEEventHandlerProcPtr    theHandler;
  191.     AEEventHandlerUPP        theUPP;
  192. };
  193. typedef struct AEHandler AEHandler;
  194. #ifdef powerc
  195. #pragma options align=reset
  196. #endif
  197.  
  198. #ifdef powerc
  199. #pragma options align=mac68k
  200. #endif
  201. typedef struct {
  202.     OSType    sfType;
  203.     char    sfTypeTerm;            /* 0-byte which terminates sfType, thus making it a c-str. */
  204.     short    windowID;
  205.     long    attributes;
  206.     Boolean    fileBasedDoc;        /* True if document can be opened/saved. */
  207.     Boolean    openAsDefault;        /* True if new document should be created as default document. */
  208.     Boolean    openAtStartup;        /* True if new document should always be created at startup. */
  209.     short    hScrollIndent;
  210.     short    vScrollIndent;
  211.     short    leftSidebar;
  212.     short    topSidebar;
  213.     char    title[2];            /* title[0] = enumerated window title */
  214.                                 /* title[1] = references and offsets to other WFMTObj definitions */
  215.                                 /* A WFMTObj can reference other for inclusion into the window 
  216.                                 ** content.  The format is TYPE,visibility,xoffset,yoffset,
  217.                                 ** TYPE,visibility,xoffset,yoffset.  A WFMTObj can reference as
  218.                                 ** many other WFMTObj's as will fit into a max pascal string.  If
  219.                                 ** this isn't enough (hard to imagine), then a WFMTObj can act as
  220.                                 ** a container for other WFMTObj's.  They can be nested as many
  221.                                 ** deep as you want. */
  222. } WFMTObj;
  223. #define mDerefWFMT(hndl) ((WFMTObj*)((*hndl) + 1))
  224. #ifdef powerc
  225. #pragma options align=reset
  226. #endif
  227.  
  228. #ifdef powerc
  229. #pragma options align=mac68k
  230. #endif
  231. typedef struct {
  232.     short    numRows;
  233.     short    numCols;
  234.     short    cellHeight;
  235.     short    cellWidth;
  236.     short    mode;
  237. } CLNewInfo;
  238. #ifdef powerc
  239. #pragma options align=reset
  240. #endif
  241.  
  242. #ifdef powerc
  243. #pragma options align=mac68k
  244. #endif
  245. typedef struct {
  246.     Rect    destRct;
  247.     Rect    viewRct;
  248.     Rect    brdrRct;
  249.     short    maxTextLen;
  250.     short    mode;
  251. } CTENewInfo;
  252. #ifdef powerc
  253. #pragma options align=reset
  254. #endif
  255.  
  256. #ifdef powerc
  257. #pragma options align=mac68k
  258. #endif
  259. typedef struct {
  260.     Boolean            selected;
  261.     Rect            rect;
  262.     char            visible;
  263.     char            hilite;
  264.     short            value, min, max;
  265.     unsigned short    procID;
  266.     long            refCon;
  267.     unsigned short    ctlID;
  268.     short            cctbID;
  269.     short            fontSize;
  270.     Style            fontStyle;
  271.     union {
  272.         CLNewInfo    clnew;
  273.         CTENewInfo    ctenew;
  274.     } extCtl;
  275.     unsigned char    title[4];        /* 4 pascal strings are stored back-to-back starting here. */
  276.                                     /* title[0] = control title */
  277.                                     /* title[1] = key equivs    */
  278.                                     /* title[2] = control font  */
  279.                                     /* title[3] = balloon help info */
  280.     short            textLen[2];        /* 2 short-prefixed data blocks stored starting here.
  281.                                     ** textLen[0] = textEdit control text block
  282.                                     ** textLen[1] = textEdit control style block */
  283. } CtlObj;
  284. #define mDerefCtl(hndl) ((CtlObj*)((*hndl) + 1))
  285. #ifdef powerc
  286. #pragma options align=reset
  287. #endif
  288.  
  289. #ifdef powerc
  290. #pragma options align=mac68k
  291. #endif
  292. typedef struct {
  293.     TreeObjHndl        ctlObj;
  294.     ControlHandle    ctl;
  295.     char            visible;
  296.     short            procID;
  297. } CObjCtl;
  298. typedef CObjCtl CObjCtlAry[];
  299. typedef CObjCtlAry *CObjCtlPtr, **CObjCtlHndl;
  300. #ifdef powerc
  301. #pragma options align=reset
  302. #endif
  303.  
  304. /* The structs CLNewInfo, CTENewInfo, and CtlObj are primarily for support of the AppsToGo
  305. ** application editor.  However, you may find it useful to know the format of the control
  306. ** objects used by the framework for control creation.  At startup time, your application is
  307. ** free to modify any control definitions.  These changes may be based on user preferences
  308. ** or whatever.  Just look up the control definition object, and change it.  When the control
  309. ** definition is used, the modification will be reflected in the control creation. */ 
  310.  
  311. #ifdef powerc
  312. #pragma options align=mac68k
  313. #endif
  314. typedef struct {
  315.     OSType    sfType;
  316.     char    sfTypeTerm;            /* 0-byte which terminates sfType, thus making it a c-str. */
  317.     Boolean    visible;
  318.     Rect    structureRect;        /* Remember where window was when saved.    */
  319.     Rect    contentRect;        /* Remember where window was when saved.    */
  320.     Rect    stdState;            /* This and below rect used for saving        */
  321.     Rect    userState;            /* zoom information for window.                */
  322. } APRFObj;
  323. #define mDerefAPRF(hndl) ((APRFObj*)((*hndl) + 1))
  324. #ifdef powerc
  325. #pragma options align=reset
  326. #endif
  327.  
  328. /********/
  329.  
  330. #define mDerefWStateData(window) (*(WStateDataHandle)(((WindowPeek)window)->dataHandle))
  331.  
  332. #define kwGrowIcon            0x00000001L
  333. #define kwHScroll            0x00000002L
  334. #define kwHScrollLessGrow    0x00000006L
  335. #define kwVScroll            0x00000008L
  336. #define kwVScrollLessGrow    0x00000018L
  337. #define kwVisible            0x00000020L
  338. #define kwOpenAtOldLoc        0x00000040L
  339. #define kwDoFirstClick        0x00000080L
  340. #define kwHideOnClose        0x00000100L
  341. #define kwIsDocument        0
  342. #define kwIsPalette            0x00000200L
  343. #define kwIsModalDialog        0x00000400L
  344. #define kwDefaultDocHeader    0x00000800L
  345. #define kwHeaderIsResource    0x00001000L
  346. #define kwRuntimeOnlyDoc    0x00002000L
  347. #define kwAutoNew            0x00004000L
  348. #define kwDefaultDocType    0x00008000L
  349. #define kwColorMonitor        0x00010000L
  350. #define kwSecondaryMonitor    0x00020000L
  351. #define kwStaggerWindow        0x00040000L
  352. #define kwCenterWindow        0x00080000L
  353. #define kwSameMonitor        0x00100000L
  354.     /* These are the various window and document attributes you can set with AppsToGo. */
  355.  
  356. #define kwNoChange            -32767
  357.     /* This constant is used to inform SetContentOrigin, SetSidebarSize, and SetScrollIndent
  358.     ** to leave either the horizontal or vertical component as it was.  This allows you to change
  359.     ** just one component without having to look up the old value for the other component. */
  360.  
  361. #define kwBotScroll            32767
  362.     /* This constant is used to inform SetContentOrigin to scroll as far as possible for either
  363.     ** the horizontal or vertical component. */
  364.  
  365. #define kwShowAll            0x01
  366. #define kwHideAll            0x03
  367. #define kwStandardVis        0x00
  368. #define kwInvertVis            0x02
  369. #define kwInvalOnHide        0x04
  370.     /* These values are used for modifying the display of a control set.  See the AppsToGo
  371.     ** manual for an explanation of control sets. */
  372.  
  373. #define kMinWindowWidth  200
  374. #define kMinWindowHeight 200
  375. #define kMaxWindowWidth  16384
  376. #define kMaxWindowHeight 16384
  377.     /* These are the default min and max sizes for a window.  They are placed in the
  378.     ** windowSizeBounds rect when a new file reference handle is created.  Simply change the
  379.     ** windowSizeBounds rect for documents that need other values. */
  380.  
  381. #define kwVHAppWindow        (kwVisible)
  382.     /* This simply means that the View Hierarchy window is initially visible.
  383.     ** (Not much good if it isn't.) */
  384.  
  385. #define kCustomEventClass  'CUST'
  386. #define keySFType          'KSFT'
  387. #define keyFSS             'KFSS'
  388. #define keyPascal          'PSTR'
  389. #define keyAppConnect      'KCNT'
  390. #define keyWindowTag       'KWND'
  391. #define keyWFMTMessage     'WFMT'
  392. #define keyRSRCMessage     'RSRC'
  393.  
  394. #define typeAppConnect     'KCNT'
  395. #define typeDoubleLong     'DBLL'
  396. #define typePascal         'PSTR'
  397. #define typePascal2        'PST2'
  398. #define typePascal3        'PST3'
  399. #define typeWFMTMessage    'WFMT'
  400. #define typeRSRCMessage    'RSRC'
  401. #define typeRSRCType       'RSTY'
  402. #define typeRSRCID         'RSID'
  403. #define typeBlockNum       'BLKN'
  404.     /* These are the various AppleEvent keys and types currently used by the framework.
  405.     ** You are free to create your own for your application's use. */
  406.  
  407. #define kGetWFMTMssg           0
  408. #define kSetWFMTMssg           1
  409. #define kMergeAppResourcesMssg 2
  410. #define kGetAppResourceMssg    3
  411. #define kSetAppResourceMssg    4
  412.     /* AppleEvent sub-messages used by the AppsToGo application editor. */
  413.  
  414. #define keyReplyErr        'errn'
  415.  
  416. #define kWrongVersion    1
  417.  
  418. #define kInvalRefNum    0
  419. #define kInvalVRefNum    0
  420.  
  421. #define kSaveYes        1
  422. #define kSaveNo            3
  423. #define kSaveCanceled    4
  424.  
  425. #define kOpenYes        1
  426. #define kOpenNo            3
  427.  
  428. #define kStdAbout        1
  429.  
  430. #define kStdNew            1
  431. #define kStdOpen        2
  432. #define kStdClose        3
  433. #define kStdSave        4
  434. #define kStdSaveAs        5
  435. #define kStdPageSetup    6
  436. #define kStdPrint        7
  437. #define kStdQuit        8
  438.  
  439. #define kStdUndo        1
  440. #define kStdRedo        2
  441. #define kStdCut            3
  442. #define kStdCopy        4
  443. #define kStdPaste        5
  444. #define kStdClear        6
  445. #define kStdViewHier    7
  446.  
  447. #define kOpenMovie ((FSSpecPtr)-1)
  448.  
  449. /********/
  450. /********/
  451. /********/
  452.  
  453. #define kViewHierFileType 'VWHR'
  454.  
  455. #define rTECtl            4000
  456. #define rListCtl        4016
  457. #define rCIconCtl        4032
  458. #define rPICTCtl        4048
  459. #define rStatTextCtl    4064
  460. #define rICONCtl        4080
  461. #define rDataCtl        4096
  462.  
  463. #define    rMenuBar    128                /* application's menu bar */
  464.  
  465. #define    rWindow        128                /* application's primary document window */
  466. #define    rVHWindow    129                /* view hierarchy window */
  467.  
  468. #define    rErrorAlert        129
  469. #define rYesNoCancel    130
  470. #define rOpenReadOnly    131
  471. #define rPrStatusDlg    132
  472.  
  473. #define    mApple    128
  474. #define    iAbout    1
  475.  
  476. #define kSave   0
  477. #define kSaveAs 1
  478. #define kClose  2
  479. #define kQuit   3
  480.  
  481. #define rNewViewCtl        128
  482.  
  483. #define rBadNewsStrings        257            /* Not-good-at-all startup error messages. */
  484. #define sWimpyMachine        1            /* Strings to display in the user item */
  485. #define sHeapTooSmall        2
  486. #define sNoFreeRoomInHeap    3
  487. #define sBadThingHappened    4
  488.  
  489. #define rFileIOStrings    258                /* Strings for StandardFile dialogs. */
  490. #define sSFprompt 1
  491. #define sWClosing 2
  492. #define sQuitting 3
  493.  
  494. #define rDefaultTitles    259
  495.  
  496. #define rPPCText    260
  497. #define sTitleText  1
  498. #define sAppText    2
  499.  
  500.  
  501. #endif
  502.